package Test;

import domain.Student1;

import java.util.ArrayList;
import java.util.Scanner;

public class Demo12 {
    public static void main(String[] args) {
        ArrayList<Student1> list = new ArrayList<Student1>();
        Student1 stu = method();
        Student1 stu1 = method();
        Student1 stu2 = method();
        list.add(stu);
        list.add(stu1);
        list.add(stu2);
        System.out.println(list.get(0).getName());
    }
    public static Student1 method(){
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        int age = sc.nextInt();
        Student1 stu = new Student1(name,age);
        return  stu;
    }
}
